package com.syswin.lhztest.demoSwagger;

import com.syswin.lhztest.demoSwagger.service.OrderService;
import com.syswin.lhztest.demoSwagger.strategy.FeeCalculationService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit4.SpringRunner;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

@RunWith(SpringRunner.class)
@SpringBootTest
public class Redisest {
	//	@Autowired
//	RedisTemplate redisTemplate;
	@Autowired
	RedisTemplate redisTemplate;

	@Test
	public void redisLoads() {
		redisTemplate.opsForValue().set("luohongzhou", "luohongzhou");
		System.out.println("---" + redisTemplate.opsForValue().get("luohongzhou"));
	}

	@Test
	public void redisServerMock() throws IOException {
		ServerSocket serverSocket = new ServerSocket(6379);
		Socket connect = serverSocket.accept();

		byte[] request = new byte[1024];
		connect.getInputStream().read(request);
		System.out.println("收到客户端请求：");
		System.out.println(new String(request));
	}
}
